<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>调用远程服务</title>

 </head>
 <body><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="class.yar-client.html">Yar_Client</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="yar-client.construct.html">Yar_Client::__construct</a></div>
 <div class="up"><a href="class.yar-client.html">Yar_Client</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div><hr /><div id="yar-client.call" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">Yar_Client::__call</h1>
  <p class="verinfo">(PECL yar &gt;= 1.0.0)</p><p class="refpurpose"><span class="refname">Yar_Client::__call</span> &mdash; <span class="dc-title">调用远程服务</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-yar-client.call-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type"><span class="type void">void</span></span> <span class="methodname"><strong>Yar_Client::__call</strong></span>
    ( <span class="methodparam"><span class="type">string</span> <code class="parameter">$method</code></span>
   , <span class="methodparam"><span class="type">array</span> <code class="parameter">$parameters</code></span>
   )</div>

  <p class="para rdfs-comment">
   发起一个RPC调用, 并且得到返回值. 如果服务端的远程调用抛出异常,
   那么本地也会相应的抛出一个<a href="class.yar-server-exception.html" class="classname">Yar_Server_Exception</a>异常.
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-yar-client.call-parameters">
  <h3 class="title">参数</h3>
  <dl>

   
    <dt>
<em><code class="parameter">method</code></em></dt>

    <dd>

     <p class="para">
      远程服务的名字.
     </p>
    </dd>

   
   
    <dt>
<em><code class="parameter">parameters</code></em></dt>

    <dd>

     <p class="para">
      调用参数.
     </p>
    </dd>

   
  </dl>

 </div>


 <div class="refsect1 returnvalues" id="refsect1-yar-client.call-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">

  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-yar-client.call-examples">
  <h3 class="title">范例</h3>
  <div class="example" id="example-5223">
   <p><strong>Example #1 <span class="function"><strong>Yar_Client::__call()</strong></span> example</strong></p>
   <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br /><br />$client&nbsp;</span><span style="color: #007700">=&nbsp;new&nbsp;</span><span style="color: #0000BB">Yar_Client</span><span style="color: #007700">(</span><span style="color: #DD0000">"http://host/api/"</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">/*&nbsp;调用远程服务的some_method服务&nbsp;*/<br /></span><span style="color: #0000BB">$result&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">$client</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">some_method</span><span style="color: #007700">(</span><span style="color: #DD0000">"parameter"</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
   </div>

   <div class="example-contents"><p>以上例程的输出类似于：</p></div>
   <div class="example-contents screen">
<div class="cdata"><pre>
</pre></div>
   </div>
  </div>
 </div>



 <div class="refsect1 seealso" id="refsect1-yar-client.call-seealso">
  <h3 class="title">参见</h3>
  <ul class="simplelist">
   <li class="member"><span class="methodname"><a href="yar-client.setopt.html" class="methodname" rel="rdfs-seeAlso">Yar_Client::setOpt()</a> - 设置调用的配置</span></li>
  </ul>
 </div>


</div><hr /><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="class.yar-client.html">Yar_Client</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="yar-client.construct.html">Yar_Client::__construct</a></div>
 <div class="up"><a href="class.yar-client.html">Yar_Client</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div></body></html>
